<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:77:"D:\fangcms\fangcms_city_add\public/../application/manage\view\poster\add.html";i:1494927175;s:80:"D:\fangcms\fangcms_city_add\public/../application/manage\view\public\header.html";i:1490355172;s:80:"D:\fangcms\fangcms_city_add\public/../application/manage\view\public\footer.html";i:1474280020;}*/ ?>
<!--添加广告-->
<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<link href="__CSS__/style.css" rel="stylesheet"/>
	<title>管理中心</title>

</head>

<body>
<div id="J_ajax_loading" class="ajax_loading">加载中...</div>

<div class="subnav">
    <div class="content_menu ib_a blue line_x">
        <?php if(!empty($sub_menu) OR !empty($big_menu)): if(!(empty($big_menu) || (($big_menu instanceof \think\Collection || $big_menu instanceof \think\Paginator ) && $big_menu->isEmpty()))): if(isset($normal)): ?>
        <a class="add fb" href="<?php echo $big_menu['iframe']; ?>"><em><?php echo $big_menu['title']; ?></em></a>
        <?php else: ?>
    	<a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo $big_menu['iframe']; ?>" data-title="<?php echo $big_menu['title']; ?>" data-id="<?php echo $big_menu['id']; ?>" data-width="<?php echo $big_menu['width']; ?>" data-height="<?php echo $big_menu['height']; ?>"><em><?php echo $big_menu['title']; ?></em></a>
        <?php endif; endif; if(!(empty($sub_menu) || (($sub_menu instanceof \think\Collection || $sub_menu instanceof \think\Paginator ) && $sub_menu->isEmpty()))): if(is_array($sub_menu) || $sub_menu instanceof \think\Collection || $sub_menu instanceof \think\Paginator): $key = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($key % 2 );++$key;if($key != 1): ?><span>|</span><?php endif; ?>
        <a href="<?php echo $val['url']; ?>" class="<?php echo $val['class']; ?>"><em><?php echo $val['name']; ?></em></a>
        <?php endforeach; endif; else: echo "" ;endif; endif; endif; ?>
    </div>
</div>

<!--图片水印设置-->
<form id="info_form" action="<?php echo url('Poster/addDo'); ?>" method="post">
<div class="pad_lr_10">
    <div class="col_tab">
        <ul class="J_tabs tab_but cu_li">
            <li class="current">添加广告</li>
        </ul>
        <div class="J_panes">
            <div class="content_list pad_10">
                    <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
                        <tr>
                            <th width="80">所属城市 :</th>
                            <td>
                                <select class="J_city_select mr10" data-pid="0" data-uri="<?php echo url('City/ajaxGetchilds'); ?>" data-selected=""></select>
                                <input type="hidden" name="city" id="J_city_id" value="" />
                            </td>
                        </tr>
                        <tr>
                            <th>广告标题 :</th>
                            <td><input type="text" name="name" id="name" class="input-text" size="40"></td>
                        </tr>
                        <tr>
                            <th>广告类型 :</th>
                            <td>
                                <select name="type" id="type">
                                    <?php if(is_array($space_type) || $space_type instanceof \think\Collection || $space_type instanceof \think\Paginator): $i = 0; $__LIST__ = $space_type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $key; ?>"><?php echo $val; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                                <span style="color:#f60;"><?php echo $space_info['name']; ?></span> <?php echo $space_info['width']; ?>*<?php echo $space_info['height']; ?> [<?php echo $space_info['type']; ?>]</td>
                        </tr>

                        <tr>
                            <th>有效时间 :</th>
                            <td>
                                <input type="text" name="startdate" id="startdate" onclick="myCalendar('startdate');" readonly class="date" size="20" value="<?php echo date('Y-m-d H:i:s'); ?>">
                                --
                                <input type="text" name="enddate" id="enddate" onclick="myCalendar();" class="date" size="20" value="<?php echo date('Y-m-d H:i:s',strtotime('+1 month')); ?>">
                            </td>
                        </tr>
                        <?php if($space_info->getData('type') == 'banner'): ?>
                        <tr>
                            <th>链接地址 : </th>
                            <td><input type="text" class="input-text" name="setting[linkurl]" size="30"></td>
                        </tr>
                        <tr>
                            <th>提示文字 : </th>
                            <td><input type="text" class="input-text" name="setting[alt]" size="30"></td>
                        </tr>
                        <tr>
                            <th>选择文件 : </th>
                            <td>
                                <input type="text" name="setting[fileurl]" id="J_img" class="input-text fl mr10" value="" size="40"/>
                                &nbsp;&nbsp; <div id="J_upload_img" class="btn btn_submit" onclick="ajaxUpload('J_upload_img','J_img');"><span>上传</span></div>
                            </td>
                        </tr>
                        <?php endif; if($space_info->getData('type') == 'couplet'): ?>
                        <tr>
                            <th>左侧链接地址 : </th>
                            <td><input type="text" class="input-text" name="setting[left][linkurl]" size="30"></td>
                        </tr>
                        <tr>
                            <th>左侧提示文字 : </th>
                            <td><input type="text" class="input-text" name="setting[left][alt]" size="30"></td>
                        </tr>
                        <tr>
                            <th>左侧文件 : </th>
                            <td>
                                <input type="text" name="setting[left][fileurl]" id="J_left_img" class="input-text fl mr10" value="" size="40"/>
                                &nbsp;&nbsp; <div id="J_left_upload_img" class="btn btn_submit" onclick="ajaxUpload('J_left_upload_img','J_left_img');"><span>上传</span></div>
                            </td>
                        </tr>
                        <tr>
                            <th>右侧链接地址 : </th>
                            <td><input type="text" class="input-text" name="setting[right][linkurl]" size="30"></td>
                        </tr>
                        <tr>
                            <th>右侧提示文字 : </th>
                            <td><input type="text" class="input-text" name="setting[right][alt]" size="30"></td>
                        </tr>
                        <tr>
                            <th>右侧文件 : </th>
                            <td>
                                <input type="text" name="setting[right][fileurl]" id="J_right_img" class="input-text fl mr10" value="" size="40"/>
                                &nbsp;&nbsp; <div id="J_right_upload_img" class="btn btn_submit" onclick="ajaxUpload('J_right_upload_img','J_right_img');"><span>上传</span></div>
                            </td>
                        </tr>
                        <input type="hidden" name="setting[paddleft]" value="<?php echo $space_info['setting']['paddleft']; ?>">
                        <input type="hidden" name="setting[paddtop]" value="<?php echo $space_info['setting']['paddtop']; ?>">
                        <?php endif; if($space_info->getData('type') == 'imagelist'): ?>
                        <tr>
                            <th>链接地址 : </th>
                            <td><input type="text" class="input-text" name="setting[linkurl]" size="30"></td>
                        </tr>
                        <tr>
                            <th>提示文字 : </th>
                            <td><input type="text" class="input-text" name="setting[alt]" size="30"></td>
                        </tr>
                        <tr>
                            <th>选择图片 : </th>
                            <td>
                                <input type="text" name="setting[fileurl]" id="J_list_img" class="input-text fl mr10" value="" size="40"/>
                                &nbsp;&nbsp; <div id="J_list_upload_img" class="btn btn_submit" onclick="ajaxUpload('J_list_upload_img','J_list_img');"><span>上传</span></div>
                            </td>
                        </tr>
                        <?php endif; if($space_info->getData('type') == 'text'): ?>
                        <tr>
                            <th>链接地址 : </th>
                            <td><input type="text" class="input-text" name="setting[linkurl]" size="30"></td>
                        </tr>
                        <tr>
                            <th>文字内容 : </th>
                            <td><input type="text" class="input-text" name="setting[title]" size="30"></td>
                        </tr>
                        <?php endif; if($space_info->getData('type') == 'code'): ?>
                        <tr>
                            <th>代码内容 : </th>
                            <td><textarea name="setting[code]" style="width:400px;height:100px;"></textarea></td>
                        </tr>
                        <?php endif; ?>
                        <tr>
                            <th>状态 :</th>
                            <td>
                                <label><input type="radio" name="status" value="1" checked> 启用</label>&nbsp;&nbsp;
                                <label><input type="radio" name="status" value="0"> 禁用</label>
                            </td>
                        </tr>
                    </table>
            </div>
        </div>
        <input type="hidden" name="spaceid" value="<?php echo $space_info['id']; ?>">
        <input type="hidden" name="setting[height]" value="<?php echo $space_info['height']; ?>">
        <input type="hidden" name="setting[width]" value="<?php echo $space_info['width']; ?>">
        <input type="hidden" name="space_type" value="<?php echo $space_info->getData('type'); ?>">
        <div class="mt10">
            <input type="submit" value="提交" id="dosubmit" name="" class="btn btn_submit" style="margin:0 0 0 100px;">
            <a id="button" href="<?php echo url('Poster/index',['space_id'=>$space_info['id']]); ?>" class="btn" style="height:20px;">返回列表</a>
            <br /><br /><br /></div>
    </div>
</div>
</form>
<script src="__PUBLIC__/js/jquery.min.1.7.2.js"></script>
<script src="__JS__/manage.js"></script>
<script src="__JS__/admin.js"></script>
<script>
//初始化弹窗
(function (d) {
    d['okValue'] = '确定';
    d['cancelValue'] = '取消';
    d['title'] = '标题';
})($.dialog.defaults);
</script>
<script src="__PUBLIC__/js/plugins/formvalidator.js"></script>
<?php if(isset($list_table)): ?>
<script src="__PUBLIC__/js/plugins/listTable.js"></script>
<script>
$(function(){
	$('.J_tablelist').listTable();
});
</script>
<?php endif; ?>
<script src="__PUBLIC__/js/calendar/WdatePicker.js" charset="utf-8"></script>
<script src="__PUBLIC__/js/plugins/fileuploader.js"></script>
<script>
    function myCalendar(id){
        WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',el:id});
    }
    $(function(){
        $('.J_city_select').cate_select({field : 'J_city_id',id : 'J_city_select',level:1});
        $.formValidator.initConfig({formid:"info_form",autotip:true});
        $("#name").formValidator({onshow:"请填写广告名称",onfocus:"请填写广告名称"}).inputValidator({min:1,onerror:"请填写广告名称"});
    });
    function ajaxUpload(btn,input){
        //上传图片

        var img_uploader = new qq.FileUploaderBasic({
            allowedExtensions: ['jpg','gif','jpeg','png','swf'],
            button: document.getElementById(btn),
            multiple: false,
            action: "<?php echo url('Poster/ajaxUploadImg'); ?>",
            inputName: 'img',
            forceMultipart: true, //用$_FILES

            showMessage: function(message){
                $.yingloujie.tip({content:message, icon:'error'});
            },
            onSubmit: function(id, fileName){
                $('#'+btn).addClass('btn_disabled').find('span').text('上传中，请稍候...');
            },
            onComplete: function(id, fileName, result){
                $('#'+btn).removeClass('btn_disabled').find('span').text('上传');
                if(result.status == '1'){
                    $('#'+input).val(result.data);
                } else {
                    $.yingloujie.tip({content:result.msg, icon:'error'});
                }
            }
        });
    }
</script>
</body>
</html>

